package program03;

/**
 * @version 1.0
 * @since:
 * @ClassName:Test
 * @author: Li Jiahui
 * @date: 2021-01-25 9:32
 */
public class Test implements CallService, NetService {
    @Override
    public void callMinutes() {
        System.out.println("我可以用来打电话");
        System.out.println("电话现在拨通");
        System.out.println("正在通话中");
        System.out.println("通话已结束");

    }

    @Override
    public void netTraffic() {
        System.out.println("我可以用来上网");

    }

    @Override
    public void phoneCardType() {
        System.out.println("我可以用来显示手机卡类");
    }
    public static void main(String[] args) {
        //1.手机卡类实例化
        MobilePhoneEnum mpe = new MobilePhoneEnum();
        mpe.userName="Li Jiahui";
        mpe.cardNumber="18550096655";
        mpe.accountBalance=100;
        mpe.show();
        //2.用户消费信息类实例化
        ConsumeInfo ci = new ConsumeInfo();
        ci.setStatNetByte(20);
        ci.setStatCallTime(77);
        ci.setStatUseFees(20);
        //1.用多态格式分别调用通话套餐和上网套餐
        // 分别声明通话套餐和上网套餐，父类类型指向子类类型对象
        SetMeal sm1 = new CallSetMeal(1000,100,110.00);
        sm1.show();
        SetMeal sm2 = new NetSetMeal(5120,30);
        sm2.show();

        //2.用多态格式分别调用通话服务接口和上网服务接口
        CallService cai = new Test();
        cai.callMinutes();
        cai.phoneCardType();
        NetService nsi = new Test();
        nsi.netTraffic();
        //假设打电话打了5分钟


        mpe.accountBalance=sm1.monthFees+sm2.monthFees-ci.getStatUseFees();
        mpe.show();
    }
}
